package net.pulseproject.commons.misc.binder;


public abstract class BooleanBinder<F> implements TypedBinder<F, Boolean> {
	
	private final F field;
	
	public BooleanBinder(final F field) {
		if(field == null) { throw new IllegalArgumentException("field == null"); }
		this.field = field;
	}
	
	public final F getField() {
		return this.field;
	}
	
	@Override
	public final void onValueSet(final Object value) {
		final Boolean booleanValue;
		if(value == null) {
			booleanValue = null;
		} else {
			booleanValue = (Boolean) value;
		}
		this.onTypedValueSet(booleanValue);
	}

}
